﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Google.GData.AccessControl;
using Google.GData.Calendar;
using PlanoAula.Core.Helper;
using PlanoAula.BD;
using PlanoAula.Repository;
using System.Transactions;

namespace PlanoAula
{
    public partial class ImportarFeriadosDoGoogleForm : FormEdicao
    {
        IDiaNaoUtilRepository repository;

        public ImportarFeriadosDoGoogleForm()
            : this(new DiaNaoUtilRepository())
        {
        }
        public ImportarFeriadosDoGoogleForm(IDiaNaoUtilRepository repositorio)
            : base()
        {
            this.repository = repositorio;
            InitializeComponent();
        }

        private void btnImportar_Click(object sender, EventArgs e)
        {
            repository.ImportarCalendarioDoGoogle(tbxUrl.Text, tbxEmail.Text, tbxSenha.Text, this.dtpDe.Value, dtpAte.Value, cbxSobrescreverExistente.Checked);
            MessageBox.Show("Calendário atualizado");
        }
        

        private void ImportarFeriadosDoGoogleForm_Load(object sender, EventArgs e)
        {
            dtpDe.Value = new DateTime(DateTime.Today.Year, 01, 01);
            dtpAte.Value = new DateTime(DateTime.Today.Year, 12, 31);
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
